# coding=utf-8

"""
    @header transfile.py
    @abstract   
    
    @MyBlog: http://www.kuture.com.cn
    @author  Created by Kuture on 2024/1/31
    @version 1.0.0 2024/1/31 Creation()
    
    @Copyright © 2024年 Mr.Li All rights reserved
"""
import base64


def trans_file_to_base64(file_path):
    """
    将文件转换为base64编码
    :param file_path:
    :return:
    """
    with open(file_path, 'rb') as file:
        return base64.b64encode(file.read()).decode('utf-8')

file_path = '/Users/NikkiMac/Desktop/mytest/config.py'
res = trans_file_to_base64(file_path)
print(res)

